import UndoReduBtn from '../Components/UndoRedo'

import {connect} from 'react-redux'
import {ActionCreators as UndoActionCreatoers} from 'redux-undo'

const mapStateToProps = (state)=>{
    console.log(state.todos)
    return {
        canUndo:state.todos.past.length>0,
        canRedu:state.todos.future.length>0
    }
}


const mapDispatchToProps = (dispatch)=>{
    return {
        onUndo: ()=>dispatch(UndoActionCreatoers.undo()),
        onRedo: ()=>dispatch(UndoActionCreatoers.redo())
    }
}

const UndoRedo = connect(
    mapStateToProps,
    mapDispatchToProps
)(UndoReduBtn)

export default UndoRedo